#!/bin/bash -ex

ctf-tools-pip install --upgrade tinyscript
ctf-tools-pip3 install --upgrade tinyscript
[ -e stegano-tools ] || git clone --recurse https://github.com/dhondta/stegano-tools

source ctf-tools-venv-activate3
mkdir -p bin
for F in `find stegano-tools -type f -iname "*.py"`; do
  N="${F##*/}"
  N="${N%.py}"
  P1="`pwd`/$F"
  P2="$VIRTUAL_ENV/bin/$N"
  echo "$N"
  chmod +x $P1
  cp $P1 $P2
  sed -i '1s/.*/\#\!\$HOME\/\.virtualenvs\/ctftools3\/bin\/python3/' $P2
  ln -s $P2 bin/$N
done
